<template>
	<view>
		<u-cell-group>
			<u-cell-item 
				v-for='(item,index) in addRequestList' 
				:key='item.id'
				:arrow="false">
				<u-avatar slot="icon"  :src="item.userInfo.figureurl"></u-avatar>
				<view slot='title'>
					<view class="u-font-36">
						{{item.userInfo.nickname}}
					</view>
					<view>
						{{item.message}}
					</view>
				</view>
				<view slot='right-icon'>
					<u-button  size='mini'  @click="handleBuddy('agree',index,item)" type="primary">同意</u-button>
					<u-button  size='mini' @click="handleBuddy('refuse',index,item)"    type="warning ">拒绝</u-button>
				</view>
				
			</u-cell-item>
		</u-cell-group>
	</view>
</template>

<script>
import ChatBase from '@/common/mixins/chat_base.js'
export default{
	mixins:[ChatBase],
	data(){
		return {
			
		}
	},
	computed:{
		addRequestList(){
			return this.$store.state.chat.addRequestList//.userRequestList
		}
	},
	methods:{
		init(){
			const data=JSON.stringify({
				controller:'User',
				method:'getUserRequest'
			})
			uni.sendSocketMessage({data})
		},
		handleBuddy(handle,index,item){
			this.$store.commit('chat/handleBuddy',index)
			const data=JSON.stringify({
				controller:'User',
				method:'handleBuddy',
				data:{
					receive:item.userInfo.id,
					handle
				},
			})
			uni.sendSocketMessage({data})
		}
	}
}
</script>

<style>
</style>
